package nowcoder.real;

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = scanner.nextInt();
            }
            Arrays.sort(a);
            int res = 0;
            for (int i = 1; i < n; i++) {
                res += a[i];
            }
            System.out.println(res);
        }
    }
}
 /* public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            ArrayList<Helper> list = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                list.add(new Helper(scanner.nextInt(),scanner.nextInt()));
            }
            ArrayList<Integer> cnt = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                ArrayList<Helper> tmp = new ArrayList<>(list);
                tmp.remove(i);
                if (judge(tmp)) {
                    cnt.add(i + 1);
                }
            }
            if (cnt.size() == 0) {
                System.out.println(cnt.size());
            } else {
                System.out.println(cnt.size());
                for (Integer i : cnt) {
                    System.out.print(i + " ");
                }
            }
        }
    }
    public static boolean judge(ArrayList<Helper> list) {
        Collections.sort(list, new Comparator<Helper>() {
            @Override
            public int compare(Helper o1, Helper o2) {
                return o1.st - o2.st;
            }
        });
        LinkedList<Helper> res = new LinkedList<>();
        res.add(list.get(0));
        for (int i = 1; i < list.size(); i++) {
            if (list.get(i).st >= res.getLast().end) {
                res.add(list.get(i));
            } else {
                res.getLast().end = Math.max(res.getLast().end,list.get(i).end);
            }
        }
        return res.size() == list.size();
    }
}
class Helper {
    int st;
    int end;

    public Helper(int st, int end) {
        this.st = st;
        this.end = end;
    }
}
*/
    /*public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            LinkedList<Integer> linkedList = new LinkedList<>();
            for (int i = 0; i < n; i++) {
                linkedList.add(scanner.nextInt());
            }
            int sum = 0;
            int cur = 1;
            boolean isPre = false;
            while (cur < n) {
                int first = linkedList.getFirst();
                int last = linkedList.getLast();
                isPre = first > last ? true : false;
                if (!isPre) {
                    linkedList.removeFirst();
                    sum += cur * first;
                } else {
                    linkedList.removeLast();
                    sum += cur * last;
                }
                cur++;
            }
            sum += linkedList.getFirst() * cur;
            System.out.println(sum);
        }
    }
}*/
   /* public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int m = scanner.nextInt();
            int n = scanner.nextInt();
            ArrayList<Integer> list = new ArrayList<>(n - m + 1);
            for (int i = m; i <= n; i++) {
                if (isAns(i)) {
                    list.add(i);
                }
            }
            if (list.size() == 0) {
                System.out.println("no");
             } else {
                for (int i = 0; i < list.size() - 1; i++) {
                    System.out.print(list.get(i) + " ");
                }
                System.out.println(list.get(list.size() - 1));
            }
        }
    }
    public static boolean isAns(int n) {
        int tmp = n;
        int g = n % 10;
        n /= 10;
        int s = n % 10;
        n /= 10;
        int b = n % 10;
        n /= 10;
        return g * g * g + s * s * s + b * b * b == tmp;
    }
}*/
   /* public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            double n = scanner.nextDouble();
            int m = scanner.nextInt();
            double sum = 0;
            int cnt = 0;
            while (cnt < m) {
                sum += n;
                n = Math.sqrt(n);
                cnt++;
            }
            System.out.printf("%.2f",sum);
        }
    }
}*/
    /*static int max = 0;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            Helper[] helpers = new Helper[n];
            for (int i = 0; i < n; i++) {
                helpers[i] = new Helper(scanner.nextInt(),scanner.nextInt());
            }
            dfs(helpers,0,new boolean[n],0,0,0,0);
            System.out.println(max);
        }
    }
    public static void dfs(Helper[] helpers,int index,boolean[] used,int x,int y,int cx,int cy) {
        if (index >= helpers.length) {
            return;
        } else {
            if (used[index]) {
                return;
            }
            used[index] = true;
            if (x == y) {
                max = Math.max(cx + cy,max);
            }
            dfs(helpers,index + 1,used,x + helpers[index].x,y,cx + helpers[index].y,cy);
            dfs(helpers,index + 1,used,x ,y + helpers[index].x,cx ,cy+ helpers[index].y);
            used[index] = false;
            dfs(helpers,index + 1,used,x ,y ,cx ,cy);
        }
    }
}
class Helper {
    int x;
    int y;

    public Helper(int x, int y) {
        this.x = x;
        this.y = y;
    }
}*/
   /* public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            int[] a = new int[n];
            int[] b = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = scanner.nextInt();
            }
            for (int i = 0; i < n; i++) {
                b[i] = scanner.nextInt();
            }
            int[][] dp1 = new int[n][n];
            for (int i = 0; i < n; i++) {
                for (int j = i; j < n; j++) {
                    if (i == j) {
                        dp1[i][j] = a[j];
                    } else if (i < j && j > 0) {
                        dp1[i][j] = Math.max(dp1[i][j - 1],a[j]);
                    }
                }
            }
            int[][] dp2 = new int[n][n];
            for (int i = 0; i < n; i++) {
                for (int j = i; j < n; j++) {
                    if (i == j) {
                        dp2[i][j] = b[j];
                    } else if (i < j && j > 0) {
                        dp2[i][j] = Math.min(dp2[i][j - 1],b[j]);
                    }
                }
            }
            int cnt = 0;
            for (int i = 0; i < n; i++) {
                for (int j = i; j < n; j++) {
                    if (dp1[i][j] < dp2[i][j]) {
                        cnt++;
                    }
                }
            }
            System.out.println(cnt);
        }
    }
}*/
    /*public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String first = scanner.nextLine();
            String[] num = first.split(",");
            int m = Integer.valueOf(num[0]);
            int n = Integer.valueOf(num[1]);
            int[][] map = new int[m][n];
            for (int i = 0; i < m; i++) {
                String cur = scanner.nextLine();
                String[] curs = cur.split(",");
                for (int j = 0; j < curs.length; j++) {
                    map[i][j] = Integer.valueOf(curs[j]);
                }
            }
            int cnt = 0;
            int max = 0;
            for (int i = 0; i < m; i++) {
                for (int j = 0; j < n; j++) {
                    if (map[i][j] == 1) {
                        cnt++;
                        max = Math.max(max,dfs(map,m,n,i,j));
                    }
                }
            }
            System.out.println(cnt + "," + max);
        }
    }
    public static int dfs(int[][] map,int r,int c,int cr,int cc) {
        if (cr >= r || cr < 0 || cc >= c || cc < 0 || map[cr][cc] == 0) {
            return 0;
        }
        int cnt = 1;
        map[cr][cc] = 0;
        cnt += dfs(map,r,c,cr + 1,cc) +
                dfs(map,r,c,cr - 1,cc) +
                dfs(map,r,c,cr,cc + 1) +
                dfs(map,r,c,cr,cc - 1) +
                dfs(map,r,c,cr - 1,cc - 1) +
                dfs(map,r,c,cr + 1,cc + 1) +
                dfs(map,r,c,cr + 1,cc - 1) +
                dfs(map,r,c,cr - 1,cc + 1);
        return cnt;
    }
}*/
    /*public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String first = scanner.nextLine();
            int m = Integer.valueOf(first);
            ArrayList<Helper> list = new ArrayList<>();
            for (int i = 0; i < m; i++) {
                String cur = scanner.nextLine();
                String[] singles = cur.split(";");
                for (int j = 0; j < singles.length; j++) {
                    String[] real = singles[j].split(",");
                    list.add(new Helper(Integer.valueOf(real[0]),Integer.valueOf(real[1])));
                }
            }
            Collections.sort(list, new Comparator<Helper>() {
                @Override
                public int compare(Helper o1, Helper o2) {
                    return o1.st - o2.st;
                }
            });
            LinkedList<Helper> res = new LinkedList<>();
            res.add(list.get(0));
            for (int i = 1; i < list.size(); i++) {
                if (list.get(i).st > res.getLast().end) {
                    res.add(list.get(i));
                } else {
                    res.getLast().end = Math.max(res.getLast().end,list.get(i).end);
                }
            }
            for (int i = 0; i < res.size() - 1; i++) {
                System.out.print(res.get(i).st + "," + res.get(i).end + ";");
            }
            System.out.println(res.get( res.size() - 1).st + "," + res.get( res.size() - 1).end);
        }
    }
}
class Helper {
    int st;
    int end;

    public Helper(int st, int end) {
        this.st = st;
        this.end = end;
    }
}*/
   /* static int max = 0;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            int k = scanner.nextInt();
            int[] a = new int[n];
            int[] t = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = scanner.nextInt();
            }
            for (int i = 0; i < n; i++) {
                t[i] = scanner.nextInt();
            }
            fun(a,t,k,0);
            System.out.println(max);
        }
    }
    public static void fun(int[] a,int[] t,int k,int cur) {
        if (cur + k > t.length) {
            return;
        } if (t[cur] == 0) {
            boolean[] change = new boolean[t.length];
            for (int i = cur; i < cur + k; i++) {
                if (t[i] == 0) {
                    change[i] = true;
                }
                t[i] = 1;

            }
            int sum = 0;
            for (int i = 0; i < t.length; i++) {
                if (t[i] == 1) {
                    sum += a[i];
                }
            }
            max = Math.max(max, sum);
            fun(a, t, k, cur + 1);
            for (int i = 0; i < t.length; i++) {
                if (change[i]) {
                    t[i] = 0;
                }
            }
        } else {
            fun(a,t,k,cur + 1);
        }
    }
}*/
  /*  public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            int m = scanner.nextInt();
            int k = scanner.nextInt();
            StringBuilder stringBuilder = new StringBuilder();
            for (int i = 0; i < n; i++) {
                stringBuilder.append('a');
            }
            for (int i = 0; i < m; i++) {
                stringBuilder.append('z');
            }
            List<String> res = fun(stringBuilder.toString());
            if (k > res.size()) {
                System.out.println(-1);
            } else {
                System.out.println(res.get(k - 1));
            }

        }
    }

    public static ArrayList<String> fun(String s) {
        ArrayList<String> res = new ArrayList<>();
        if (s.length() < 1) {
            return res;
        }
        char[] chars = s.toCharArray();
        Arrays.sort(chars);
        backtrack(chars,new boolean[chars.length], "", res);
        return res;
    }
    private static void backtrack(char[] chars, boolean[] used, String s, ArrayList<String> res) {
        if (s.length() == chars.length) {
            res.add(s);
            return;
        }
        for (int i = 0; i < chars.length; i++) {
            if (used[i]) {
                continue;
            }
            if (i != 0 && chars[i] == chars[i - 1] && !used[i - 1]) {
                continue;
            }
            used[i] = true;
            backtrack(chars, used, s + chars[i], res);
            used[i] = false;
        }
    }

}*/
  /*  public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = scanner.nextInt();
            }
            int[] heap = new int[n];
            for (int i = 0; i < n; i++) {
                if (i == 0) heap[i] = a[i];
                else {
                heap[i] = heap[i - 1] + a[i];
                }
            }
            int m = scanner.nextInt();
            for (int i = 0; i < m; i++) {
               int q = scanner.nextInt();
                System.out.println(binarySearch(heap,q) + 1);
            }
        }
    }
    public static int binarySearch(int[] heap,int q) {
        int lo = 0;
        int hi = heap.length - 1;
        while (lo < hi) {
            int mid = lo + (hi - lo) / 2;
            if (q <= heap[mid]) {
                hi = mid;
            } else {
                lo = mid + 1;
            }
        }
        return hi;
    }
}
*/